package com.azt.service.wechat;

import com.alibaba.fastjson.JSONObject;
import feign.Param;
import feign.RequestLine;

/**
 * 微信调用接口
 * Created by LiQZ on 2017/3/30.
 */
public interface WeChatCaller {

    /**
     * 返回示例：
     * {
     * "access_token":"ACCESS_TOKEN",
     * "expires_in":7200,
     * "refresh_token":"REFRESH_TOKEN",
     * "openid":"OPENID",
     * "scope":"SCOPE",
     * "unionid": ""
     * }
     */
    @RequestLine("GET /sns/oauth2/access_token?appid={APPID}&secret={SECRET}&code={CODE}&grant_type=authorization_code")
    JSONObject getAccessToken(@Param("APPID") String appid, @Param("SECRET") String secret, @Param("CODE") String code);

    /**
     * 返回示例：
     *  {
     *  "country":"中国",
     *  "unionid":"",
     *  "province":"",
     *  "city":"",
     *  "openid":"",
     *  "sex":1,
     *  "nickname":"小败",
     *  "headimgurl":"",
     *  "language":"zh_CN","privilege":[]
     *  }
     */
    @RequestLine("GET /sns/userinfo?access_token={ACCESS_TOKEN}&openid={OPENID}&lang=zh_CN")
    JSONObject getUserInfo(@Param("ACCESS_TOKEN") String accessToken, @Param("OPENID") String openId);
    
    
    

}
